class Person {
  private _name: string;
  private _age: number;

  constructor(name: string, age: number) {
    this._name = name;
    this._age = age;
  }

  sayHello() {
    console.log(
      `Hello, my name is ${this._name} and I am ${this._age} years old`
    );
  }

  get name() {
    return this._name;
  }
}

class Student extends Person {
  private _gender: string;
  private _score: number;

  constructor(name: string, age: number, gender: string, score: number) {
    super(name, age);
    this._gender = gender;
    this._score = score;
  }

  sayScore() {
    console.log(`My score is ${this._score}`);
  }
}

const zhangsan = new Student("张三", 18, "男", 100);
zhangsan.sayHello();
zhangsan.sayScore();
console.log(zhangsan.name);
